<?php

/**
 * Klasa inicjalizująca zasoby aplikacji
 * @author InformationMastery
 *
 */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    /**
     * Inicjacja pluginu acl-a
     * @return Zend_Application_Module_Autoloader
     */
    protected function _initAutoload() {
        $moduleLoader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => '',
                    'basePath' => APPLICATION_PATH));

        $fc = Zend_Controller_Front::getInstance();
        //$this->_auth = Zend_Auth::getInstance();
        //$this->_acl = new Zend_Acl();

        $fc->setParam('auth', $this->_auth);
        $fc->setParam('acl', $this->_acl);
        //$request = $fc->getRequest();
        //$fc->registerPlugin( new acl($this->_auth, $this->_acl) );
        //$fc->registerPlugin(new jezykPlugin());

        return $moduleLoader;
    }

    /**
     * Inicjuje podstawowe metadane serwisu, oraz inicjuje widok
     * @return void
     */
    function _initViewHelpers() {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();

        $view->doctype('XHTML1_TRANSITIONAL');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headMeta()->appendHttpEquiv('X-UA-Compatible', 'IE=edge');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle('NTeaser');
    }

    /**
     * Metoda  ustawiajaca config w globalnym rejstrze Zenda
     * @return void  
     */
    protected function _initConfig() {
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
        Zend_Registry::set('config', $config);
    }

}
